import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    loading: false,
    loadingTitle: '正在加载...'
  },
  mutations: {
    showLoading(state, title) {
      state.loading = true;
      state.loadingTitle = title || '正在加载...';
    },
    hideLoading(state) {
      state.loading = false
    }
  }
});